home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_high.lha / LEDA-3.1c-high / man / polygon.tex < prev    next >
Encoding:
Text File  |  1994-08-05  |  2.8 KB  |  83 lines

  1. \bigskip
  2. \bigskip
  3. {\magonebf  6.1.4 Polygons (polygon)}
  4.  
  5. {\bf 1. Definition}
  6.  
  7. An instance $P$ of the data type $polygon$ is a simple polygon 
  8. in the two-dimensional plane defined by the sequence of its vertices
  9. in clockwise order. The number of vertices is called the size 
  10. of $P$. A polygon with empty vertex sequence is called empty.
  11.  
  12. \def\name{$polygon$}
  13. \def\type{$polygon$}
  14.  
  15. {\bf 2. Creation}
  16.  
  17. a) \create P (list\<point\>\  pl)
  18.  
  19. b) \create P {}
  20.  
  21.  
  22. introduces a variable \var\ of type \name. \var\ is initialized to the
  23. polygon with vertex sequence $pl$. \precond The vertices in $pl$ are given 
  24. in clockwise order and define a simple polygon.  Variant b) creates the empty 
  25. polygon and assigns it to \var.
  26.  
  27. \bigskip
  28. {\bf 3. Operations}
  29.  
  30. \medskip
  31. \+\cleartabs & \hskip 2.6truecm & \hskip 5.1truecm &\cr
  32. \+\op list\<point\>   vertices {}
  33.                            {returns the vertex sequence of \var.}
  34. \smallskip
  35. \+\op list\<segment\> segments {}
  36.                            {returns the sequence of bounding segments}
  37. \+\nop                     {of \var\ in clockwise order.}
  38. \smallskip
  39. \+\op list\<point\>   intersection {line\ l}
  40.                            {returns $P \cap l$ as a list of points.}
  41. \smallskip
  42. \+\op list\<point\>   intersection {segment\ s}
  43.                            {returns $P \cap s$ as a list of points.}
  44. \smallskip
  45. \+\op list\<polygon\> intersection {polygon\ Q}
  46.                            {returns $P \cap Q$ as a list of points.}
  47. \smallskip
  48. \+\op bool          inside {point\ p}
  49.                            {returns true if $p$ lies inside of $P$,}
  50. \+\nop                     {false otherwise.}
  51. \smallskip
  52. \+\op bool          outside {point\ p}
  53.                            {returns !\var.inside($p$).}
  54. \smallskip
  55. \+\op polygon       translate {vector\ v} {}
  56. \+\nop                     {returns $P+v$, i.e., the polygon created by}
  57. \+\nop                     {translating $P$ by vector $v$. \precond $v$}
  58. \+\nop                     {has dimension 2.}
  59. \smallskip
  60. \+\op polygon       translate {double\ \alpha,\ double\ d} {}
  61. \+\nop                    {returns the polygon created by a translation}
  62. \+\nop                    {of \var\ in direction $\alpha$ by distance $d$}
  63. \smallskip
  64. \+\op polygon       rotate {point\ q,\ double\ \alpha}
  65.                           {returns the polygon created by a rotation of}
  66. \+\nop                    {$P$ about point $q$ by angle $\alpha$.}
  67. \smallskip
  68. \+\op double          size {}
  69.                            {returns the size of \var.}
  70. \smallskip
  71. \+\op bool          empty {}
  72.                            {returns true if \var\ is empty, false otherwise.}
  73. \smallskip
  74.  
  75.  
  76. \bigskip
  77. {\bf 4. Operators }
  78. \medskip
  79. \+&$bool$       &$polygon$ ==    $polygon$     &test for equality\cr
  80. \smallskip
  81. \+&$bool$       &$polygon$\ !=\  $polygon$     &test for inequality\cr
  82.  
  83.